﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Models
{
    public class PlayerSearch
    {
        public int? Sort { get; set; }
        public string Name { get; set; }
        public string GenerateWhere()
        {
            var where = string.Empty;
            if (Sort.HasValue)
            {
                where += string.Format(" and sort = {0}", Sort);
            }
            if (!string.IsNullOrWhiteSpace(Name))
            {
                where += string.Format(" and name like '%{0}%'", Name);
            }
            return where;
        }
    }
}
